//
//  XiaoKaiUserTableView.m
//  Project_A
//
//  Created by 凯 on 15/7/21.
//  Copyright (c) 2015年 zhoukaidong. All rights reserved.
//

#import "XiaoKaiUserTableView.h"
#import "XiaoKaiAttackTableViewCell.h"
#import "DataBase.h"
#import "UserModel.h"
#import "XiaoKaiUserNewTableViewCell.h"

@implementation XiaoKaiUserTableView


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    self = [super initWithFrame:frame style:style];
    if (self) {
        self.delegate = self;
        self.dataSource = self;
//        self.bounces = NO;
        self.rowHeight = SCREEN_HEIGHT / 4;

         
    }
    return self;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    DataBase *dbManger = [DataBase shareInstance];
    [dbManger openDB];
    self.arr = [dbManger selectInfo];
//    NSLog(@"大哥在这呢%@", self.arr);
    
    return self.arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *str = @"usertableview";
    XiaoKaiUserNewTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (!cell) {
       cell = [[XiaoKaiUserNewTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:str];

    }
    UserModel *model = self.arr[indexPath.row ];
    cell.Model = model;
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"你瞅啥");
    
}




@end
